window.onload = function() {

	var ipt = document.getElementById("ipt");
	var wz = document.getElementById("wz");

	ipt.onkeyup = function() {

		var chang = ipt.value.length;

		//log 日志
		console.log(chang);

		if(chang == 0) {
			wz.innerHTML = "请输入用户名";
			wz.style.color = "red";
		} else if(chang > 10) {
			wz.innerHTML = "输入的字符数大于10";
			wz.style.color = "red";
		} else if(chang < 5) {
			wz.innerHTML = "输入的字符小于5";
			wz.style.color = "red";
		} else {
			wz.innerHTML = "长度符合要求";
			wz.style.color = "lightgreen";
		}
	}

}